package com.candy.common.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.io.Serializable;
import java.util.*;

/**
 * <p>
 * 通用表单 服务类
 * </p>
 *
 * @author pxs
 * @since 2021-12-13
 */
public interface ICommonService
{
    /**
     * 保存
     * @param entity
     * @param tableName
     * @return boolean
     */
    boolean saveMap(HashMap<String, Object> entity, String tableName);

    /**
     * 批量保存
     * @param entityList
     * @param tableName
     * @return boolean
     */
    boolean saveMapBatch(Collection<HashMap<String ,Object>> entityList, String tableName);

    /**
     * 更新
     * @param entity
     * @param tableName
     * @return boolean
     */
    boolean updateMapById(HashMap<String ,Object> entity, String tableName);

    /**
     * 批量更新
     * @param entityList
     * @param tableName
     * @return boolean
     */
    boolean updateMapBatchById(Collection<HashMap<String ,Object>> entityList, String tableName);

    /**
     * 获取详情
     * @param id
     * @param tableName
     * @return java.util.HashMap<java.lang.String,java.lang.Object>
     */
    HashMap<String,Object> getMapById(Serializable id, String tableName);

    /**
     * 查询
     * @param entity
     * @param tableName
     * @return java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>>
     */
    List<HashMap<String,Object>> getMapList(HashMap<String ,Object> entity, String tableName);

    /**
     * 分页查询
     * @param page
     * @param entity
     * @param tableName
     * @return com.baomidou.mybatisplus.core.metadata.IPage<java.util.Map<java.lang.String,java.lang.Object>>
     */
    IPage<Map<String, Object>> getMapsPage(Page<?> page, HashMap<String ,Object> entity, String tableName);
}
